package com.example.mykotlin.base.config

import org.springframework.beans.propertyeditors.StringTrimmerEditor
import org.springframework.web.bind.WebDataBinder
import org.springframework.web.bind.annotation.ControllerAdvice
import org.springframework.web.bind.annotation.InitBinder


@ControllerAdvice(basePackages = ["com.example.mykotlin.controller"])
class StringHttpRequestParamTrimAdvice {

    /**
     * 去除get方式的参数空格
     * @param binder
     */
    @InitBinder
    fun initBinder(binder: WebDataBinder) = binder.registerCustomEditor(String::class.java, StringTrimmerEditor(false))


}